#pragma once
#define ZERO_VECTOR D3DXVECTOR3(0.0f,0.0f,0.0f)
#define STATE_PATHFIND 0
#define STATE_HPAPATHFIND 2
#define SRC_AND_DEST_PATHFIND 3
#define SRC_AND_DEST_HPAPATHFIND 4
#define STATE_VIS_CHECK_TILE_TO_TILE 5
#define STATE_VIS_CHECK_POS_TO_TILE 6
#define STATE_VIS_CHECK_POS_TO_POS 7
#define STATE_PATH_SMOOTHED 9
#define STATE_SET_NOT_WALKABLE 1
#define STATE_FINAL_PATH 8
#define STATE_UNIT_SET 10


class cVis;
class cWindow;
class c2DDevice;
class cMap;
class cMap;
class cSelect;
class cAstarPathFind;
class cBinaryHeap;
class cQuadRenderer;
class cLineRenderer;
class cPath;
class cMain
{
private:
int State;
	cVis * Vis;
	cWindow * Window;
	c2DDevice * TwoDDevice;
	cMap * Map;
	cSelect * Select;
	cAstarPathFind * AstarPathFind;
	cBinaryHeap * BinaryHeap;
	cQuadRenderer * QuadRenderer;
	cLineRenderer * LineRenderer;
	cPath * Path;
public:
	
	cWindow & GetWindow(){ return *Window; }
	cMap & GetMap(){ return *Map; }
	cSelect & GetSelect(){ return *Select; }
	cAstarPathFind & GetAstarPathFind(){ return *AstarPathFind; }
	cPath & GetPath(){ return *Path; }
	cVis & GetVis(){ return *Vis; }
	cQuadRenderer & GetQuadRenderer(){ return *QuadRenderer; }
	cLineRenderer & GetLineRenderer(){ return *LineRenderer; }
	cBinaryHeap & GetBinaryHeap(){return *BinaryHeap;}
	c2DDevice & GetTwoDDevice(){return *TwoDDevice;}
	
	int GetState(){ return State; }
	void SetState(int State){this->State = State; }
	void MainLoop();
	void Init();
	void Init(cWindow * Window, c2DDevice * TwoDDevice,cMap * Map, cSelect* Select, cVis * Vis, cAstarPathFind * AstarPathFind ,cBinaryHeap * BinaryHeap ,cQuadRenderer * QuadRenderer, cLineRenderer * LineRenderer, cPath * Path);
	cMain();
	~cMain();
};